<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <t-popup
      class="placement bottom center"
      attach="#attach"
      content="查看本单元全景展厅"
      placement="bottom"
      showArrow
      destroyOnClose
      :disabled="store.isMobileType ? true : false"
    >
      <img
        v-if="props.info.digitalShowroom"
        class="icon-3d blinking-animation-style"
        id="outlineIcon"
        @click="open(props.info.digitalShowroom)"
        :src="publicUrls + 'free/style4/3dIcon.png'"
      />
    </t-popup>
    <img class="outline-parent-bg" :src="publicUrls + 'free/style4/Level1outlineStyle1Bg.webp'" alt="" />
    <div class="outline jy-style-height">
      <div class="outline-content">
        <div
          class="content-tiitle"
          :class="props.info.subTitle || props.info.value || props.info.remarks ? '' : 'writing'"
        >
          {{ props.info.text }}
        </div>
        <div class="line" v-if="props.info.subTitle || props.info.value || props.info.remarks">
          <div class="block"></div>
        </div>
        <p class="outline-subTitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
        <div class="cover" v-if="props.info.value" :class="!props.info.remarks && 'cover-height'">
          <img
            class="outline-cover"
            @click="ImgVisible = true"
            :src="urls + props.info.value + '?imageView2/3/format/webp'"
            alt=""
          />
        </div>
      </div>
      <TextMax
        :data="props.info.remarks"
        :title="props.info.text"
        :infoData="props.info"
        :row="props.info.value ? 7 : 17"
      ></TextMax>
    </div>
    <img class="shadow" :src="publicUrls + 'free/style4/firstLevelOutline1Shadow.png?imageView2/3/format/webp'" alt="" />
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free4Style1',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { computed, defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';

const ImgVisible = ref(false);
const store = useProjectStore();
const title = ref();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};

const titleSlice = computed(() => {
  let title: string;
  if (props.info.text?.length > 4) {
    if (props.info.text?.length <= 9) {
      title = props.info.text.slice(-2);
    } else {
      title = props.info.text.slice(-4);
    }
  }
  return title;
});
</script>

<style scoped lang="less">
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-left: 120px;
  margin-top: 0;
  .shadow {
    width: 820px;
    height: 254px;
    position: absolute;
    bottom: 0;
    left: 40px;
  }
  .icon-3d {
    width: 37px;
    height: 47px;
    object-fit: contain;
    position: absolute;
    top: -1px;
    right: 45px;
    z-index: 21;
  }
}
.outline-parent-bg {
  width: 648px;
  height: 100%;
  position: relative;
  z-index: 20;
}
.outline {
  position: absolute;
  top: -0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding: 72px 136px 72px 128px;
}
.outline-content {
  display: flex;
  align-items: center;
  justify-content: start;
  flex-direction: column;
  width: 100%;
  height: 100%;
}
.content-tiitle {
  height: 96px;
  color: #5391a3;
  font-family: 'SourceHanSerifCN-Bold';
  font-size: 32px;
  line-height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.writing {
  height: 100% !important;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 12px;
}
.outline-subTitle {
  color: #333;
  text-align: center;
  font-family: 'SourceHanSerifCN';
  font-size: 18px;
  line-height: 28px;
  margin-top: 8px;
}
.line {
  width: 100%;
  height: 1px;
  background: #83b0b3;
  margin-top: 23px;
  position: relative;
  .block {
    width: 48px;
    height: 4px;
    background: #83b0b3;
    margin: 0 auto;
    margin-top: -2px;
  }
}
.cover-height {
  width: 288px !important;
  height: 420px !important;
  background: url('https://static.jiyi.show/free/style4/Level1outlineStyle1Img2Bg.webp') no-repeat center/100% 100% !important;
  padding: 11px !important;
}
.cover {
  width: 100%;
  height: 236px;
  margin: 54px 0;
  padding: 10px;
  background: url('https://static.jiyi.show/free/style4/Level1outlineStyle1ImgBg.webp') no-repeat center/100% 100%;
  .outline-cover {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: contain;
  }
}

::v-deep .textMore-box {
  padding: 0 25px;
}
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: #333 !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-weight: 500 !important;
  text-decoration-line: underline;
}
::v-deep .t-popup__content {
  background: #bcd5d5;
  box-shadow: none;
  padding: 0 10px;
  line-height: 20px;
  color: #fcffff;
}
::v-deep .t-popup__arrow::before {
  background: #bcd5d5;
  border: none;
  box-shadow: none !important;
}
</style>